package com.github.ginirohikocha.dbm.util;

import android.content.Context;
import android.util.Log;

import com.tencent.android.tpush.XGIOperateCallback;
import com.tencent.android.tpush.XGPushConfig;
import com.tencent.android.tpush.XGPushManager;

public class XingeUtil {
    public static void initXG(Context context, String account) {
        XGPushConfig.enableDebug(context,true);
        XGPushConfig.enableOtherPush(context, true);
//        XGPushConfig.setHuaweiDebug(true);
//        XGPushConfig.setMiPushAppId(getApplicationContext(), "d72792766de56");
//        XGPushConfig.setMiPushAppKey(getApplicationContext(), "aade2100b37db33b91ce83a230839c16");
//        XGPushConfig.setMzPushAppId(this, "d72792766de56");
//        XGPushConfig.setMzPushAppKey(this, "aade2100b37db33b91ce83a230839c16");
        XGPushManager.registerPush(context, account, new XGIOperateCallback() {
            @Override
            public void onSuccess(Object data, int flag) {
                //token在设备卸载重装的时候有可能会变
                Log.d("TPush", "注册成功，设备token为：" + data);
            }
            @Override
            public void onFail(Object data, int errCode, String msg) {
                Log.d("TPush", "注册失败，错误码：" + errCode + ",错误信息：" + msg);
            }
        });
    }

    public static void logout(Context context, String account) {
        XGPushManager.delAccount(context, account);
    }
}
